import { Maze, Room, Direction, Wall, Door } from '../common'
import { MazeFactory, MazeGame } from '../Abfactory/factory'
class MazePrototypeFactory extends MazeFactory {
    declare private _prototypeMaze
    declare private _prototypeRoom
    declare private _prototypeWall
    declare private _prototypeDoor
    constructor(m: Maze, w: Wall, r: Room, d: Door) {
        super()
        this._prototypeMaze = m
        this._prototypeWall = w
        this._prototypeRoom = r
        this._prototypeDoor = d
    }

    MakeMaze(): Maze {
        return this._prototypeMaze.Clone()
    }
    MakeDoor(r1: Room, r2: Room): Door {
        const door = this._prototypeDoor.Clone()
        door.Initialize(r1, r2);
        return door
    }
    MakeRoom(n: number): Room {
        return this._prototypeRoom.Clone()
    }
    MakeWall(): Wall {
        return this._prototypeWall.Clone()
    }
}


const game = new MazeGame()
const simpleMazeFactory = new MazePrototypeFactory(new Maze(), new Wall(),
    new Room(0), new Door(new Room(0), new Room(1)))

game.createMaze(simpleMazeFactory)